<%@include file='templates/include_header.html'%>

<title>Cult Ticketing System</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css">" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/structure.css" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/form.css" type="text/css" />



<style type="text/css">
fieldset {
  padding: 1em;
  font:80%/1 sans-serif;
  }
label {
  float:left;
  width:25%;
  margin-right:0.5em;
  padding-top:0.2em;
  text-align:right;
  font-weight:bold;
  }

legend {
  padding: 0.2em 0.5em;
  border:1px solid green;
  color:green;
  font-size:90%;
  text-align:left;
  }
  input #submit { position:relative;left:900px; }
  #head_image { margin-bottom:25px; }

</style>

</head>

<body>
<div id="container">

<%@include file='templates/include_menu.html'%>

    <div id="main">
        <div id="content">
          <div id="head_image">
        	<div id="slogan"><strong>Cult Ticketing System -- Sign Up</strong><br />
       	    </div>
            <div id="under_slogan_text">
                <br /><br /><br /><br />

            </div>
          </div>

         <div id="left">
             <h2>Login</h2>
			<form action="login.jsp" method="post">
                                <div>
                                <div id="label"><b>Email Address :</b></div>
                                <div class="roundedfield" >
                                    <input name="email" type="text" size="20" maxlength="20"/>
                                </div>
                            </div>
                            <div>
                                <div id="label"><b>Password :</b></div>
                                <div class="roundedfield" >
                                    <input type="password" name="password"  size="20" maxlength="20"/>
                                </div>
                            </div><br />
                            <input type="submit" value="Login" id="loginbutton" name="loginbutton"/>
                         </form>
         </div>

         <div id="right">
<form action="sign_up.jsp" method="post" onsubmit="return validateForm()" name="signup">
<fieldset>
<legend>New to Here ? </legend>
	<p class="signup"><label for="email">Email Address: </label><input name="emailaddress" maxlength="50" size="30" type="text" /><span style="color: red;">*</span><br /></p>
        <p class="signup"><label for="cemail">Confirm Email: </label><input name="cemailaddress" maxlength="50" size="30" type="text" /><span style="color: red;">*</span><br /></p>
        <p class="signup"><label for="password">Password: </label><input name="password" maxlength="20" size="20" type="text" /><span style="color: red;">*</span><br /></p>
	<p class="signup"><label for="scode">Security Code: </label><input type="text" maxlength="5" size="5" id="securitycode" datatype="Integer" msg="Security code must be entered." name="securitycode" /> <span style="color: red;">*</span>
	<img id="rndimg" style="vertical-align: middle;" src="/downloaditem/code/img.php" /> <a href="Javascript:img()">Can't Read?</a><br /></p>
        <input value="Sign Up" type="submit" id="submit" style="border: solid 1px black; position: relative; left: 30px;" />
</fieldset>
</form>
        </div>
            
<script>
function validateForm()
{
var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var error = false;
var error_msg = '';

var x=document.forms["signup"]["emailaddress"].value
var y=document.forms["signup"]["cemailaddress"].value
var z=document.forms["signup"]["password"].value
var p=document.forms["signup"]["securitycode"].value

	if (!(filter.test(x)) || x.length<1) {
		error = true;
		error_msg += "Please input email address!\n\n";
	}

        if (!(filter.test(y)) && y.length>=1) {
		error = true;
		error_msg += "Invalid email address!\n\n";
	}

        if(x != y) {
		error = true;
		error_msg += "Email Addresses do not match!\n\n";
	}

        if (z.length<6) {
		error = true;
		error_msg += "Please input at least 6 digits for password!\n\n";
	}

	if(p.length<5) {
		error = true;
		error_msg += "Please input the security code!\n";
	}
	if(error) {
		alert(error_msg);
		return false;
	}


}

</script>

	</div>
</div>
</div>

<%@include file='templates/include_footer.html'%>